﻿using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace Web
{
    public class Global : HttpApplication
    {
        public void RegisterRoutes(RouteCollection routes)
        {
            // Note: Change the URL to "{controller}.mvc/{action}/{id}" to enable
            //       automatic support on IIS6 and IIS7 classic mode
            //自定义转接格式
            RouteTable.Routes.Add(new Route("{controller}.mvc/{action}", new MvcRouteHandler())
            {
                Defaults = new RouteValueDictionary(new { action = "Index" }),
            });

            RouteTable.Routes.Add(new Route("Default.aspx", new MvcRouteHandler())
            {
                Defaults = new RouteValueDictionary(new { controller = "Home", action = "Index", id = "" }),
            });
        }

        protected void Application_Start()
        {
            RegisterRoutes(RouteTable.Routes);
        }

        public override void Init()
        {
            base.Init();
        }
    }
}